cat -A a.txt # -vET (All: non-printable, end of lines, tabs)
tr -dc '[:print:]\n' < a.txt | cat -A # delete, complement set1
cat -n txt
cat -ns txt
cat -b txt
cat -b < txt | sed /^$/d
grep -v '^#' /etc/default/hddtemp | sed '/^$/d' > hddtemp
cat hddtemp
tac hddtemp
dmesg | tac
ls -l /etc/grub.d | head -5
ls -l /etc/grub.d | head -5 | sort -k5 -t ' ' # key [field,to field] | separator
ls -l /etc/grub.d | head -5 | sort -n -r -k5,5
cat txt
sort txt
sort -k1,1 -k2,2n txt
ls -lF /etc/network | sort -k8.4 #char4 in key8
cat txt
sort txt | uniq -i # makes output unique, ignore case
sort txt | uniq -c # count
sort txt | uniq -d # only duplicates
sort txt | uniq -u # only uniqe rows
ln txt h-txt; ln txt h2-txt
find -maxdepth 1 -type f -links +1 -printf "%p %i\n" | tee out
sort out | uniq -d
sort out | uniq -f1 -dc # -f skip n first field
head /etc/group | grep adm
cat /etc/group | grep milad | cut -f1 -d: | tr '\n' ' ' | xargs echo
id milad -Gn
head -4 /etc/passwd | cut --complement -f2-4,7 -d:
date | tee txt | cat -A
cut -f4 -d' ' < txt
tr -s ' ' < txt | cut -f4 -d' ' | cut -c 4- # tr: -s, --squeeze-repeats
head -5 /etc/passwd
cut -f1,7 /etc/passwd -d: | head -5
cut -f2-6 --complement /etc/passwd -d: | head -5
head -5 /etc/passwd | cut -f1 -d: | tee users
head -5 /etc/passwd | cut -f7 -d: | tee shells
paste shells users -d':'
cat namev; echo ---; cat namet;
join namev namet
cat namev; echo ---; cat namet;
join -1 2 -2 1 namev namet # -j when both are same
Compare sorted files FILE1 and FILE2 line by line.
When FILE1 or FILE2 (not both) is -, read standard input.
cat f1; echo ---; cat f2
comm f1 f2
comm -3 f1 f2 # do not show 3
echo - | cat f1 - f2
diff f1 f2
Line 2 to 3 from file one has been changed in file two.
We should replace them with 2 to 4 from file two to make them same.
echo - | cat f1 - f2
diff f1 f2
After line 2 in file one, add line 3 from file two (which is yellow)
echo - | cat f1 - f2
diff f1 f2
echo "__-_-_-__" | cat f1 - f2
diff -c f1 f2
Ardabil -> Tehran,
Remove Esfehan,
Add shiraz
diff f1 f2
diff -u f1 f2
diff -y f1 f2
diff f1 f2 # check with default output
diff f1 f2 -e > changes
cat changes
echo 'w' >> changes # hey ed write to file ;)
cat f1 # before running ed
ed < changes f1
cat f2 # after ed did the job
diff f1 f2
md5sum f1 f2
diff f1 f2
diff -u f1 f2 > diff
cat diff
patch < diff
cat f1
echo "Here is some text." | tr -d ' '
tr -c -d '[:upper:]\n' < f1
echo "Hi_this_is_a-TEST" | tr '[:upper:]_-' '[:lower:] '
ipynb
format: https://github.com/ravexina/linux-notes. html
exports of project available at: https://ravexina.github.io/linux-notes.Linux Notes by Milad As (Ravexina) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.